import bb.cascades 1.0

TabbedPane {
    showTabsOnActionBar: true
    activeTab: browseTab
    Tab {
        id: searchTab
        title: "Search"
        imageSource: "asset:///images/navigation/ic_search.png"
        NavigationPane {
            id: searchNavPane
            objectName: "Search"
            SearchPage {
	            id: searchPage
	        }
        }
    }
    Tab {
        id: browseTab
        title: "Browse"
        imageSource: "asset:///images/navigation/ic_browse.png"
        NavigationPane {
            id: browseNavPane
            objectName: "Browse"
            BrowsePage {
                id: browsePage
	        }
        }
    }
    property variant navPane: activeTab.content
    property bool pushEnabled: ! ("applicationMenuPage" in navPane.top)
    Menu.definition: MenuDefinition {
        settingsAction: SettingsActionItem {
            title: "Settings"
            enabled: pushEnabled
            onTriggered: {
                navPane.push(settingsPageCD.createObject())
            }
            attachedObjects: [
                ComponentDefinition {
                    id: settingsPageCD
                    source: "asset:///SettingsPage.qml"
                }
            ]
        }
        helpAction: HelpActionItem {
            title: "Help"
            enabled: pushEnabled
            onTriggered: {
                navPane.push(helpPageCD.createObject())
            }
            attachedObjects: [
                ComponentDefinition {
                    id: helpPageCD
                    source: "asset:///HelpPage.qml"
                }
            ]
        }
        actions: [
            ActionItem {
                enabled: pushEnabled
                title: "About"
                imageSource: "asset:///images/navigation/ic_info.png"
                onTriggered: {
                    navPane.push(aboutPageCD.createObject())
                }
                attachedObjects: [
                    ComponentDefinition {
                        id: aboutPageCD
                        source: "asset:///AboutPage.qml"
                    }
                ]
            }
        ]
    }
}
